﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NaireSystem.Datas;
using TYBase;

namespace NaireSystem.Api
{
    public class QtRecordApi
    {
        public static RPage<QtVO> GetListQt(PageInfo page, QtQueryDto queryDto)
        {
            try
            {
                var route = new
                {
                    pageSize = page.PageSize,
                    pageIndex = page.PageIndex,
                };
                LocalHttp http = new LocalHttp();
                if (!http.SetBaseUri(AppData.Url)
                    .SetUrl($"/qtRecord/getListQt?{route.AsQueryData()}&{queryDto.AsQueryData()}").SetGet().Excute(out string data))
                {
                    return RPage<QtVO>.Fail(data);
                }
                return data.AsModel<RPage<QtVO>>();
            }
            catch (Exception ex)
            {
                return RPage<QtVO>.Fail("获取用户失败!", ex);
            }
        }

        public static R<List<QtVO>> GetListQtByIds(List<int> listId)
        {
            try
            {
                LocalHttp http = new LocalHttp();
                if (!http.SetBaseUri(AppData.Url)
                    .SetUrl($"/qtRecord/getListQtByIds")
                    .SetData(listId.JsonAsString())
                    .SetPost()
                    .Excute(out var data))
                {
                    return R<List<QtVO>>.Fail(data);
                }
                return data.AsModel<R<List<QtVO>>>();
            }
            catch (Exception ex)
            {
                return R<List<QtVO>>.Fail("获取列表失败!", ex);
            }
        }


        public static R<List<QtVO>> GetListLearnQtByIds(List<int> listId)
        {
            try
            {
                LocalHttp http = new LocalHttp();
                if (!http.SetBaseUri(AppData.Url)
                    .SetUrl($"/qtRecord/getListLearnQtByIds")
                    .SetData(listId.JsonAsString())
                    .SetPost()
                    .Excute(out var data))
                {
                    return R<List<QtVO>>.Fail(data);
                }
                return data.AsModel<R<List<QtVO>>>();
            }
            catch (Exception ex)
            {
                return R<List<QtVO>>.Fail("获取列表失败!", ex);
            }
        }


 
    }
}
